<script src="{{ getAssets }}js/bivariatetable/bivariatetable.js" type="text/javascript"></script>
<script type="text/javascript">
var goods_id = '{{.goods_id}}';
var entry_id = '{{.entry_id}}';
var middle_id = '{{.middle_id}}';

$(function(){
	$.post('{{ urlfor "ErpEntryController.OtherAdd" }}',{'goods_id':goods_id, 'middle_id': middle_id}, function(res){
		if(res.code == 0) {
			$('#goods-title').html(productGroupName(res.data.goods));
			$('#purchase_num').val(res.data.middle[0].purchase_num);
		}
	}, 'json');
	
});


$('#submitBtn').click(function(){
	var purchase_num = $('#purchase_num').val();
	var dataInfo = new Array();
	if(purchase_num == '') {
		layer.alert('请填写采购数量');
		return false;	
	}
	dataInfo.push({'purchase_num':Number(purchase_num)});
	$.post('{{ urlfor "ErpEntryController.SaveEntryData" }}', {'purchase_num': purchase_num, 'dataInfo':JSON.stringify(dataInfo), 'middle_id': middle_id,'goods_id':goods_id,'entry_id':entry_id}, function(res){
		if(res.code == 1) {
			layer.alert(res.msg);
			return false;	
		}
		parent.closeSelectComplete();
	}, 'json');
	
	return false;
});
</script>